package com.aviation.sell_ticket.mapper;

import com.aviation.sell_ticket.pojo.Aviation_flight;
import com.aviation.sell_ticket.pojo.Aviation_flight_price;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FlightPriceMapper {

    @Select("select first_class_price,commercial_affairs_price,economy_price from aviation_flight_price where flight_id=#{flightId}")
    public Aviation_flight_price queryFlightPrices(@Param("flightId") String flightId);

    @Select("<script>select flight_id,first_class_price,commercial_affairs_price,economy_price from aviation_flight_price " +
            "where flight_id in <foreach item='item' index='index' collection='flight' open='(' separator=',' close=')'>#{item.flight_id}</foreach> ORDER BY economy_price LIMIT 0,2" +
            "</script>")
    public List<Aviation_flight_price> queryFlightPriceMap(@Param("flight") List<Aviation_flight> flight);

}
